﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Threading;
using System.Threading;

namespace BehaviorFramework
{
    public static class Extensions
    {
        static public void InvokeIfRequired(this Dispatcher dispatcher, Action action)
        {

            if (dispatcher.CheckAccess())
            {
                action();
            }
            else
            {
                dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
            }
        }
    }
}
